using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace DealerWorld.Forms
{
    public partial class line_item : Form
    {
		private Dictionary<string, string> codeLookup = new Dictionary<string, string>();

        public line_item()
        {
            InitializeComponent();

			cmbLaborCode.Items.Add("M13 - Transmission Service");
			cmbLaborCode.Items.Add("M2 - Lube/Oil/Filter");
			cmbLaborCode.Items.Add("M3 - Differential Service");
			cmbLaborCode.Items.Add("M4 - Tires, Rotate");


			this.codeLookup.Add("M13 - Transmission Service", "M13");
			this.codeLookup.Add("M2 - Lube/Oil/Filter", "M2");
			this.codeLookup.Add("M3 - Differential Service", "M3");
			this.codeLookup.Add("M4 - Tires, Rotate", "M4");
        }

		private void button2_Click(object sender, EventArgs e)
		{
			/*string code = "Code: " + this.codeLookup[cmbLaborCode.SelectedItem.ToString()];
			string laborOp = "Labor Op: " + textBox4.Text.Trim();
			string laborType = "Labor Type: " + textBox2.Text.Trim();
			string comeback = "Is Come back: " + textBox3.Text.Trim();
			string tech = "Tech No.: " + textBox6.Text.Trim();
			string dispatch = "Dispatch Code: " + textBox8.Text.Trim();
			string estDur = "Estimated Duration: " + textBox7.Text.Trim();
			string lineEst = "Line Estimate: " + textBox9.Text.Trim();
			string description = "Description: " + textBox5.Text.Trim();

			repair_order.lineItemReturn.Add(code + " - " + laborOp + " - " + laborType + " - " + comeback + " - " + tech + " - " + dispatch + " - " + estDur + " - " + lineEst + " - " + description);
			//*/

			foreach (string item in lstCurLineItems.Items)
			{
				repair_order.lineItemReturn.Add(item);
			}

			this.Close();
		}

		private void button1_Click(object sender, EventArgs e)
		{
			this.Close();
		}

		private void btnSaveAndNew_Click(object sender, EventArgs e)
		{
			string code = "Code: " + this.codeLookup[cmbLaborCode.SelectedItem.ToString()];
			string laborOp = "Labor Op: " + textBox4.Text.Trim();
			string laborType = "Labor Type: " + textBox2.Text.Trim();
			string comeback = "Is Come back: " + textBox3.Text.Trim();
			string tech = "Tech No.: " + textBox6.Text.Trim();
			string dispatch = "Dispatch Code: " + textBox8.Text.Trim();
			string estDur = "Estimated Duration: " + textBox7.Text.Trim();
			string lineEst = "Line Estimate: " + textBox9.Text.Trim();
			string description = "Description: " + textBox5.Text.Trim();

			lstCurLineItems.Items.Add(code + " - " + laborOp + " - " + laborType + " - " + comeback + " - " + tech + " - " + dispatch + " - " + estDur + " - " + lineEst + " - " + description);

			textBox4.Text = "";
			textBox2.Text = "";
			textBox3.Text = "";
			textBox6.Text = "";
			textBox8.Text = "";
			textBox7.Text = "";
			textBox8.Text = "";
			textBox9.Text = "";
			textBox5.Text = "";
		}
    }
}